﻿@model EvincePayroll.Data.UserRoleData
@{
   
    ViewBag.Title = "ShowRole";
}

<script src="../../Scripts/Data_Table/jquery.dataTables.min.js" type="text/javascript"></script>
<script type="text/javascript">

    $(document).ready(function () {

        // setupLeftMenu();

        var oTable2 = $('#showRoleTable').dataTable({

            "bServerSide": true,
            "sAjaxSource": "/UserRole/AjaxShowRole",
            "bProcessing": true,
            "sPaginationType": "full_numbers",
            "aoColumns":
[
{ "sName": "UserRoleId", "sTitle": "Leave ID", "bVisible": false, "bSortable": true, "fnRender": function (oObj) { return oObj.aData[0]; } },
{ "sName": "RoleName", "sTitle": "RoleName", "bVisible": true, "bSortable": true, "fnRender": function (oObj) { return oObj.aData[1]; } },
{ "sName": "Action", "sTitle": "Action", "bVisible": true, "bSortable": true, "fnRender": function (oObj) { return oObj.aData[2]; } }
            



]
        });
        oTable2 = $('#showRoleTable').dataTable();
    });

        // setSidebarHeight();

        function DeleteRole(userId) {

            var temp = confirm('Are you sure want to delete?');
            if (temp == true) {
                $.ajax({
                    type: "POST",
                    url: "/UserRole/DeleteRole?userId=" + userId,
                    success: function (message) {



                        var oTable2 = $('#showRoleTable').dataTable();
                        oTable2.fnDraw();
                        if (message.result == false) {
                           // window.Error("You Can't Delete This Role");
                            alert("You Can't Delete This Role");

                        }
                        $('#showRoleTable').width('auto');
                        return false;


                    },
                    error: function (data) {
                        alert("You Cant Delete This Role");
                    }


                });
            }
        }
    
   

</script>
 <div class="grid_5">

            <div class="box round">
                <h2>Role List</h2>
                <div class="block">
                    
                    <table class="data display datatable" id="showRoleTable">
					<thead>
                <tr>
                 
                     <th>
                    </th>
                    <th>
                    </th>
                    <th>
                    </th>
                   
                </tr>
            </thead>
					
				</table>
                   

                    
                </div>
            </div>
            
        </div>
